using NUnit.Framework;
using ValidationFramework.Specifications;
using ValidationFramework.Specifications.Tests.Helpers;

namespace ValidationFramework.Specifications.Tests
{
    [TestFixture]
    public class MatchesRegexRuleAttributeTests
    {
        [Test]
        public void Create_Spec_Constructs_MatchesRegexSpec()
        {
			// Arrange
			const string expectedRegEx = "aaa";
			var mockDescriptor = new FakeReflectionInfo();
			var expectedSpec = new MatchesRegexSpec(expectedRegEx);

			// Act
			var attribute = new MatchesRegexAttribute(expectedRegEx);
			var spec = (MatchesRegexSpec)attribute.CreateSpecification(mockDescriptor);

			// Assert
			Assert.IsTrue(spec.IsEquivalentTo(expectedSpec));
        }
    }
}